package priv.lirenhe.javasuper.collection;

public class Student extends Object{

	public Student() {
		
	}
	
	public Student(int id,String name){
		this.id = id;
		this.name = name;
	}
	
	private int id;
	private String name;
	
	
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public static void main(String[] args) {
		Object obj = new Object();
		obj.hashCode();
	}
	
	@Override
	public int hashCode(){
		return this.name.hashCode();
	}
	
	@Override
	public boolean equals(Object obj) {
		if(this == obj){
			return true;
		}
		if(! (obj instanceof Student)){
			return false;
		}
		//自定义
		if(this.id == ((Student)obj).getId()){
			if(this.name.equals(((Student)obj).getName())){
				return true;
			}
		}
        return false;
    }

}
